<template>
	<view class="header"  :style="{color:`${color}`}">
		<view v-if="showIcon" class="headLeft" :class="{'headLeft-iconblack':iconblack}">
			<text class="iconfont" @tap="handleGoBack">
				&#xe64b;
			</text>|
			<text class="iconfont" @tap="handleGoHome">
				&#xe622;
			</text>
		</view>
		{{title}}
	</view>
</template>

<script>
	export default {
		name:"Header",
		props:{
			title:{
				type:String,
				required:true
			},
			showIcon:{
				type:Boolean,
				required:false,
				default:true
			},
			color:{
				type:String,
				required:false,
				default:'white'
			},
			iconblack:{
				type:Boolean,
				required:false,
				default:false
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			handleGoBack(){
				uni.navigateBack()
			},
			handleGoHome(){
				uni.navigateTo({
					url: '/pages/index/index',
				});
			}
		}
	}
</script>

<style lang='scss' scoped>
	.header {
		width: 100%;
		height:75px;
		font-size: 16px;
		text-align: center;
		line-height: 80px;
		position: relative;
		/* color: white; */
		
		.headLeft {
			position: absolute;
			left:8px;
			top: 28px;
			width: 90px;
			height: 30px;
			background: rgba(0,0,0,0.4);
			color: white;
			line-height: 31px;
			border-radius: 15px;
			display: flex;
			justify-content: space-evenly;
			
			&-iconblack {
				color:black;
				border: 1px #eaeaea solid;
				background-color: white;
			}
		}
	}
</style>
